<?php
/* @var $this PortfolioController */
/* @var $model Portfolio */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'portfolio-form',
        // Please note: When you enable ajax validation, make sure the corresponding
        // controller action is handling ajax validation correctly.
        // There is a call to performAjaxValidation() commented in generated controller code.
        // See class documentation of CActiveForm for details on this.
        'enableAjaxValidation' => false,
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
    ));
    ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php // echo $form->labelEx($model,'id'); ?>
        <?php // echo $form->textField($model,'id');  ?>
        <?php // echo $form->error($model,'id');  ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'name'); ?>
        <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 150)); ?>
        <?php echo $form->error($model, 'name'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'short_description'); ?>
        <?php echo $form->textArea($model, 'short_description', array('rows' => 3, 'cols' => 50)); ?>
        <?php echo $form->error($model, 'short_description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'detail'); ?>
        <?php echo $form->textArea($model, 'detail', array('rows' => 6, 'cols' => 50)); ?>
        <?php echo $form->error($model, 'detail'); ?>
    </div>

    <div class="row">   
        <?php echo $form->labelEx($model, 'link'); ?>
        <?php echo $form->textField($model, 'link', array('size' => 60, 'maxlength' => 100)); ?>
        <?php echo $form->error($model, 'link'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'mediaFile'); ?>
        <?php echo (!$model->isNewRecord) ? CHtml::link(CHtml::label($model->media, 'media'), $model->imageWebPath()) : " " ?>
        <?php echo $form->fileField($model, 'mediaFile'); ?>
        <?php echo $form->error($model, 'mediaFile'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'tags'); 
    $this->widget('ext.taging.TagInput', array(
 		'model' => $model,
 		'attribute' => 'assigntags',
 		'url' => $this->createUrl("tagsearch"),
// 		'options' => array(
// 			'allowCreation' => true,
// 			'preventDuplicates' => true,
//         //  'resultsFormatter' => 'js:function(item){ return “<li><p>” + item.name + “</p></li>” }',
// 			'theme' => 'facebook',
// 		)
 	));
?>
    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save'); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->